<template>
  <div class="aboutUs pages_content">
    <el-container>
      <el-header>
        <breaDcrumb />
      </el-header>
      <el-main>
        <div class="editor">
          <editor-bar :value="richText" @geteditor="geteditor"></editor-bar>
        </div>
        <div class="button">
          <el-button size="medium" class="bottom_all" @click="save()">发布</el-button>
        </div>
      </el-main>
    </el-container>
  </div>

</template>
<script>
import breaDcrumb from "@/components/breadcrumb";
import EditorBar from '@/components/wangEnduit';
import { updateOne, queryOne } from '@/api/basedata/aboutUs';
import { Loading } from 'element-ui';
export default {
  components: { EditorBar, breaDcrumb },
  data() {
    return {
      richText: '',
      id: ''
    }
  },
  created() {
    queryOne().then(res => {
      this.id = res.data.id
      this.richText = res.data.mession
    })
  },
  methods: {
    save() {
      let loadingInstance = Loading.service({ text: '信息发放中...' });
      let data = new Object()
      data.mession = this.richText
      data.id = this.id
      updateOne(data).then(res => {
        loadingInstance.close();
        if (res.code == 1001) {
          this.$message({
            message: '修改成功',
            type: 'success'
          });
        }

      })
    },
    geteditor(data) {
      this.richText = data
    },
  },
}
</script>

<style lang='scss' scope>
.editor {
  width: 100%;
  height: calc(100% - 46px);
}
.button {
  height: 46px;
  padding-top: 10px;
}
</style>

